<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">

<head>
    <meta charset="UTF-8">
    <title>login</title>
    <script src="https://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script>
    <style>
        * {
            margin: 0;
            padding: 0;
        }

        html {
            height: 100%;
            width: 100%;
            overflow: hidden;
            margin: 0;
            padding: 0;
            background: url(/img/Desert.jpg) no-repeat 0 0;
            background-size: 100% 100%;
            -moz-background-size: 100% 100%;
        }

        body {
            display: flex;
            align-items: center;
            justify-content: center;
            height: 100%;
        }

        #loginDiv {
            width: 37%;
            display: flex;
            justify-content: center;
            align-items: center;
            height: 300px;
            background-color: rgba(75, 81, 95, 0.3);
            box-shadow: 7px 7px 17px rgba(52, 56, 66, 0.5);
            border-radius: 5px;
        }

        #name_trip {
            margin-left: 50px;
            color: red;
        }

        p {
            margin-top: 30px;
            margin-left: 20px;
            color: azure;
        }

        input {
            margin-left: 15px;
            border-radius: 5px;
            border-style: hidden;
            height: 30px;
            width: 140px;
            background-color: rgba(216, 191, 216, 0.5);
            outline: none;
            color: #f0edf3;
            padding-left: 10px;
        }

        .button {
            border-color: cornsilk;
            background-color: rgba(100, 149, 237, .7);
            color: aliceblue;
            border-style: hidden;
            border-radius: 5px;
            width: 100px;
            height: 31px;
            font-size: 16px;
        }
    </style>

    <script>
        function checkForm() {
            var elementById01 = document.getElementById("username").value;
            var elementById02 = document.getElementById("password").value;
            if (elementById01 === ''||elementById01===null) {
                alert("账户不能为空")
                return false
            }
            if(elementById02 ===''||elementById02===null){
                alert("密码不能为空")
                return false
            }
        }

    </script>
</head>

<body>
<div id="loginDiv">
    <form th:action="@{/log}" id="form" method="get" onsubmit="return checkForm()">
        <h1 style="text-align: center;color: aliceblue;">LOGIN  IN</h1>
        <p>User Name:<label for="username"></label><input id="username" type="text" name="username"><label id="name_trip"></label></p>

        <p>Password: <label for="password"></label><input id="password" type="password" name="password"><label id="password_trip"></label></p>

        <p></p>
        <div style="text-align: center;margin-top: 30px;">
            <input type="submit" class="button" value="登录">
<!--            <input type="button" th:src="@{/res}" class="button" value="注册">-->
            <input type="button" class="xxx" onclick="location.href=('/res')" value="注册">
        </div>
<!--        <button type="submit">ooo</button>-->
    </form>
</div>

</body>
</html>